Carbon


GetFormatOrder

Header: QuickdrawText.h Carbon status: Supported

Determines the display order display order of style runs for a line of text containing multiple style runs with mixed directions.

void GetFormatOrder (
    FormatOrderPtr ordering, 
    SInt16 firstFormat, 
    SInt16 lastFormat, 
    Boolean lineRight, 
    StyleRunDirectionUPP rlDirProc, 
    Ptr dirParam
);
ordering

A pointer to a format order array, with (lastFormat – firstFormat + 1) entries. The function fills the array with the display order of each style run. On exit, the array contains a permuted list of the numbers from firstFormat to lastFormat.

The first entry in the array is the number of the style run to draw first; this is the leftmost style run in display order. The last entry in the array is the number of the entry to draw last, the rightmost style run in display order.

Upon completion of the call, the FormatOrder array contains the numbers identifying the style runs in display order.

firstFormat

A number greater than or equal to 0 identifying the first style run in storage order that is part of the line for which you are calling GetFormatOrder.

lastFormat

A number greater than or equal to 0 identifying the last style run in storage order that is part of the line for which you are calling GetFormatOrder.

lineRight

A flag that you set to TRUE if the primary line direction is right-to-left.

rlDirProc

A pointer to a callback function that calculates the correct direction, given the style run identifier. The GetFormatOrder function calls the application-defined rlDirProc function for each identifier from firstFormat to lastFormat.

This function returns TRUE for right-to-left text direction and FALSE for left-to-right. Given dirParam and a style run identifier, the callback function should be able to determine the style run direction. For more information, see StyleRunDirectionProcPtr.

dirParam

A pointer to a parameter block that contains the font and script information for each style run in the text. This parameter block is used by the application-supplied function.

DISCUSSION

The GetFormatOrder function helps you determine how to draw text that contains multiple style runs with mixed directions. For mixed-directional text, after you determine where to break the line, you need to call GetFormatOrder to determine the display order. When you call GetFormatOrder, you supply a Boolean function, and reference it using the rlDirProc parameter. This function calculates the direction of each style run identified by number. Do not call GetFormatOrder if there is only one style run on the line.

You must index the style runs in storage order. You pass GetFormatOrder numbers identifying the first and last style runs of the line in storage order and the primary line direction. The GetFormatOrder function returns to you an equivalent sequence in display order.

If you do not explicitly define the primary line direction of the text, base the lineRight parameter on the value of the SysDirection global variable. (The SysDirection global variable is set to -1 if the system direction is right to left, and 0 if the system direction is left to right.)

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when InterfaceLib 7.1 or later is installed. Exported by CarbonLib 1.0 and later and by InterfaceLib 7.1 and later.


© 2000 Apple Computer, Inc. — (Last Updated 4/4/2000)